#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>

using namespace std;

const int N = 1e5+7;
int n,m1,m2,a[N],b[N],c[N],d[N],t1[N],t2[N],ans,tot,o1[N],o2[N],sum1[N],sum2[N];
struct node{
	int num,data;
};
priority_queue <node> q1;
bool operator <(node a,node b){
	return a.data > b.data;
}
int maxn1,maxn2;
int flag,ad[N];
priority_queue <int,vector<int>,greater<int> > q2;
struct cnm{
	int t1,t2;
}e[N];
int x[N],y[N];
int t[N],r;
bool cmp(cnm a,cnm b){
	return a.t1 < b.t1;
}
int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	int n,m1,m2;
	cin >> n >> m1 >> m2;
//	q2.push(1);q2.push(2);cout<<q2.top();q2.pop();q2.pop();
	for(int i = 1; i <= m1; i++){
		scanf("%d%d",&e[i].t1,&e[i].t2);
	}
	sort(e+1,e+1+m1,cmp);
	for(int i = 1; i <= m1; i++){
		a[i] = e[i].t1;b[i]=e[i].t2;
		int now = 0;
		while(!q1.empty() && q1.top().data <= a[i]){
			int o = q1.top().num;q1.pop();
			q2.push(o);
		}
		if(!q2.empty()){
			int o = q2.top();
			if(o == 3) t[++r] = a[i],t[++r]=b[i];
			ad[o]++;
			q2.pop();
			q1.push((node){o,b[i]});
		}
		else{
			++tot;ad[tot]++;
			q1.push((node){tot,b[i]});
		}
	}
	for(int i = 1; i <= n; i++) x[i]=x[i-1]+ad[i];
//	cout << endl;
	while(!q1.empty()) q1.pop();
	while(!q2.empty()) q2.pop();
	memset(ad,0,sizeof(ad));
	tot = 0;
	for(int i = 1; i <= m2; i++){
		scanf("%d%d",&e[i].t1,&e[i].t2);
	}
	sort(e+1,e+1+m2,cmp);
	for(int i = 1; i <= m2; i++){
		a[i]=e[i].t1;b[i]=e[i].t2;
		int now = 0;
		while(!q1.empty() && q1.top().data <= a[i]){
			int o = q1.top().num;q1.pop();
			q2.push(o);
		}
		if(!q2.empty()){
			int o = q2.top();
			ad[o]++;
			q2.pop();
			q1.push((node){o,b[i]});
		}
		else{
			++tot;ad[tot]++;
			q1.push((node){tot,b[i]});
		}
	}
//	for(int i = 1; i <= n; i++) q3.push(ad[i]);
//	for(int i = 1; i <= n; i++) cout << ad[i];
	for(int i = 1; i <= n; i++) y[i]=y[i-1]+ad[i];
/*	for(int i = 1; i <= n; i++) cout << x[i] << " ";
	cout << endl;
	for(int i = 1; i <= n; i++) cout << y[i] << " ";*/
	for(int i = 0; i <= n; i++) ans = max(ans,x[i]+y[n-i]);
	cout << ans;
}
